<script>
$(function(){

	/* building buttons and attach click events */
	$( "#btnNewsNew" ).button({
		icons: {
			primary: "ui-icon-circle-plus"
		},
		text: true
    });
	$( "#btnNewsFirst" ).button({
		icons: {
			primary: "ui-icon-seek-first"
		},
		text: false
    });
	$( "#btnNewsPrev" ).button({
		icons: {
			primary: "ui-icon-seek-prev"
		},
		text: false
    });
	$( "#btnNewsNext" ).button({
		icons: {
			primary: "ui-icon-seek-next"
		},
		text: false
    });
	$( "#btnNewsLast" ).button({
		icons: {
			primary: "ui-icon-seek-end"
		},
		text: false
    });
	$( "#btnNewsSelChannel" ).button({
		icons: {
			primary: "ui-icon-play"
		},
		text: true,
    });
/*    $( "#btnNewsNewChannel" ).button({
		icons: {
			primary: "ui-icon-circle-plus"
		},
		text: true,
    }); */
	$( "#btnNewsRefresh" ).button({
		icons: {
			primary: "ui-icon-play"
		},
		text: false,
    });
});

function deleteNews (id, e)
{

$('#newsDelDialog').dialog({
	//autoOpen: false,
	modal: true,
	resizable: false,
	dialogClass: 'alert',
	position: [ e.pageX, e.pageY ],
	buttons: {
		"Удалить": function() {
			$('#newsDelDialogId').val(id);
			$('#newsDelDialogForm').submit();
			$( this ).dialog( "close" );
		},
		"Нет спасибо в другой раз": function() {
			$( this ).dialog( "close" );
		}
	}
});


}

</script>

<style>
.left
{
	float:left;
}
br
{
	clear:both;
}
.first
{
	width:20%%
}
.middle
{
	width:40%
}
.end
{
	width:40%
}
</style>
<span class="ui-widget-header ui-corner-all left" style="width:100%">
<div class="left first">
	<button name="act" value="new" id="btnNewsNew">Новая новость</button>
</div>
<div class="left middle">
	<button name="act" value="first" id="btnNewsFirst">К первым записям</button>
	<button name="act" value="prev" id="btnNewsPrev">К следующим записям</button>
	<input type="text" value="<?php echo $browse['step']; ?>" maxlenght="10" name="step" style="width:40px"></a>
	<button name="act" value="refresh" id="btnNewsRefresh">Обновить</button>
	<button name="act" value="next" id="btnNewsNext">Предыдущие записи</button>
	<button name="act" value="last" id="btnNewsLast">К последним записям</button>
	от
	<?php
	 if ($browse['total'] > 0)
		$browse['start'] += 1;
	 echo $browse['start'];
	 ?> до
	<?php
		$t = $browse['start'] + $browse['step'] - 1;
		if ($t > $browse['total'])
			$t = $browse['total'];
		echo $t;
	?>
	( <?php echo $browse['total'] ?> )
</div>
<div class="left end">
	<select style="width:200px;" name="channel">
		<option value="">Все каналы
		<?php
foreach ($channels as $channel)
{
	isset($_REQUEST['channel'])&&$_REQUEST['channel']==$channel?$selected=' selected':$selected='';
	print '<option value="'.htmlentities($channel, ENT_COMPAT, 'UTF-8').'"'.$selected.'>'.htmlentities($channel, ENT_COMPAT, 'UTF-8');
}

		?></select>
	<button name="act" value="sel_channel" id="btnNewsSelChannel">Выбрать раздел</button>
	<!-- <button name="act" value="new_channel" id="btnNewsNewChannel">Создать раздел</button> -->
</div>
</span>
<?php if (!empty($mesg)) { ?>
<br>
<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
	<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
	<strong>Ура!</strong> <?php echo $mesg; ?></p>
</div>
<?php } ?>
<?php if (!empty($error)) { ?>
<br>
<br>
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
	<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
	<strong>Внимание:</strong> <?php echo $error; ?></p>
</div>
<?php } ?>
<br /><br />